<script>
	import platform from "@/src/platform";
	export default {
		onLaunch: function() {
			console.log('App Launch');
		},
		onShow: async function() {
			console.log('JXC App Show',wx.bgMusic,wx.musicStatus);
			platform.init();
			// let user = await platform.getUserInfo();
			// if(user.identity!=1){
			// 	uni.redirectTo({
			// 		url:`/pages/permission?identity=${user.identity}`
			// 	})
			// }else{
			// if(wx.bgMusic&&wx.musicStatus=='play'){
			// 	wx.bgMusic.play();
			// }else{
			// 	wx.musicStatus = 'stop';
			// 	wx.bgMusic&&wx.bgMusic.stop();
			// }
			if(wx.activity=='activeA'||wx.activity=='activeB'){
				if(wx.bgMusic&&wx.musicStatus == 'play'){
					wx.bgMusic.stop&&wx.bgMusic.stop();
					wx.bgMusic.destory&&wx.bgMusic.destory();
					wx.bgMusic = platform.getAudioPlayer(this.imgPath+`/static/big/${wx.activity}.mp3`);
					wx.musicStatus = 'play';
					wx.musicInstance&&(wx.musicInstance.status = 'play');
					
				}
				
			}
		},
		onHide: function() {
			wx.removeStorageSync('updatetime');
			console.log('App Hide');
			// if(wx.bgMusic){
			// 	wx.bgMusic.stop();
			// }
		}
	}
</script>
<style lang="scss">
	@import 'uview-ui/index.scss';
	@import './uni.scss';
</style>
